Visualise the Flora Danica Cleaned Metadata

Contents

Visualise the Flora Danica Cleaned Metadata#

Before you start#

Before you begin running this script on your own computer, please note that the script uses the following libraries, which are not part of the standard packages. You can install them from your notebook using pip install. Create a new cell and run the following:

!pip install matplotlib plotly-express

# Import libraries
import pandas as pd
import plotly.express as px
# Load the cleaned dataset
subset_df = pd.read_csv(r'.\mekuni_flora_danica_data\flora_danica_tidy_format.csv')
# Count and plot authors
author_data_in = subset_df['author_st'].value_counts().to_frame().reset_index()

fig = px.bar(author_data_in, x='author_st', y='count',
             color_discrete_sequence=["#13dbb7"],
                 title='Authors and Number of Published Plates')


# Update layout for better readability
fig.update_layout(
    xaxis_title='Authors',
    yaxis_title='Count',
    xaxis_tickangle=-45,  # Rotate x-axis labels for better readability
    yaxis=dict(showgrid=True, gridcolor="#45d6d3", gridwidth=0.5),  # Add gridlines
    plot_bgcolor='white'  # Set the background color to white
)

fig.show()
taxonomy_data_in = subset_df['taxonomic_group_st'].value_counts().to_frame().reset_index()
taxonomy_data_in = taxonomy_data_in.query('count > 15')

# Use Plotly to create a chart
fig = px.bar(taxonomy_data_in,x='taxonomic_group_st', y='count',
             color_discrete_sequence=["#ea7600"],
                 title='Plant Groups')


# Customize layout to improve readability
fig.update_layout(
    xaxis_title='Taxonomic Group',
    yaxis_title='Count',
    xaxis_tickangle=-45,  # Rotate x-axis labels
    yaxis=dict(showgrid=True, gridcolor="#45d6d3", gridwidth=0.5),  # Add gridlines
    plot_bgcolor='white'  # Set background color to white
)

fig.show()